import sqlite3 as sql
from ib.ext.Contract import Contract
import ibconfig as ibcfg
from Queue import Queue

#------------------------------------------------------------------
#            global definitions
#------------------------------------------------------------------
contractmap = dict()
msgq = Queue()

# db init
dbcon = sql.connect(':memory:')
cur = dbcon.cursor()
#schema
cur.execute('create table prix (ticker_id int, field text, price real)')
cur.execute('create table ivo (ticker_id int, field text, ivol real)')
dbcon.commit()
cur.close()

#------------------------------------------------------------------
#            Config Settings
#------------------------------------------------------------------
front = '20110715'
mid = '20110620 '
back = '20110720'

sleeptime = 2

# debug mode. shows msgs like NextValidId, error and other pure virtuals


outputfile = open('c:/junk/scratch.txt','r+')

# which 'set' of ib msgs will be handled.
# options: basic: only pricing msgs, noisy: all msgs 
mode = 'basic'
callbacklist = ibcfg.sessionmode[mode] 

#------------------------------------------------------------------
#           debug stuff
#------------------------------------------------------------------
debug = ibcfg.debug



